from datetime import datetime
from typing import List, Optional
from pydantic import BaseModel

class MomentBase(BaseModel):
    content: str
    images: Optional[List[str]] = []
    is_public: bool = True

class MomentCreate(MomentBase):
    pass

class MomentUpdate(BaseModel):
    content: Optional[str] = None
    images: Optional[List[str]] = None
    is_public: Optional[bool] = None

class Moment(MomentBase):
    id: str
    user_id: str
    like_count: int = 0
    comment_count: int = 0
    created_at: datetime
    updated_at: datetime

class LikeBase(BaseModel):
    user_id: str
    moment_id: str

class LikeCreate(LikeBase):
    pass

class Like(LikeBase):
    id: str
    created_at: datetime

class CommentBase(BaseModel):
    content: str
    moment_id: str
    parent_comment_id: Optional[str] = None

class CommentCreate(CommentBase):
    pass

class CommentUpdate(BaseModel):
    content: Optional[str] = None

class Comment(CommentBase):
    id: str
    user_id: str
    created_at: datetime